﻿<UserControl x:Class="AutoLoL.Controls.ChampionSelectControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:converters="clr-namespace:AutoLoL.Converters"
             mc:Ignorable="d" 
             x:Name="RootElement"
             d:DesignHeight="300" d:DesignWidth="300" Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <converters:ObjectToVisibilityConverter x:Key="ObjectToVisibilityConverter" />
    </UserControl.Resources>
    <ItemsControl Name="ChampionsItemsControl">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <WrapPanel IsItemsHost="True" />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <CheckBox Name="SelectedCheckBox" Margin="0 0 3 3" ToolTip="{Binding Path=Name}" Checked="SelectedCheckBox_Checked" Unchecked="SelectedCheckBox_Unchecked">
                    <CheckBox.Template>
                        <ControlTemplate>
                            <Border BorderBrush="DimGray" BorderThickness="1">
                                <Grid Cursor="Hand">
                                    <Image Width="32" Height="32" Source="{Binding Path=IconBitmapImage}" />
                                    <Rectangle Width="32" Height="32" Fill="#77FFFFFF" Visibility="{Binding ElementName=SelectedCheckBox, Path=IsChecked, Converter={StaticResource ObjectToVisibilityConverter}, ConverterParameter=True}" />
                                    <Border BorderThickness="2" BorderBrush="LightGreen" Visibility="{Binding ElementName=SelectedCheckBox, Path=IsChecked, Converter={StaticResource ObjectToVisibilityConverter}}" />
                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </CheckBox.Template>
                </CheckBox>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</UserControl>
